home *** CD-ROM | disk | FTP | other *** search
/ Chip: Hang es video / CHIP_ZENESZERKESZTO_2005.ISO / audio_3 / visual / robotfunk / setup.exe / {app} / main.dxr / Internal_18.ls < prev    next >
Encoding:
Text File  |  2003-11-19  |  2.2 KB  |  54 lines

  1. property oldcomposerect
  2. global lightImage, offscreenBuffer, composerect, composewidth, composeheight
  3.  
  4. on lightinit
  5.   lightImage = image(composewidth, composeheight, 32)
  6.   lightImage.fill(0, 0, composewidth, composeheight, rgb(0, 0, 0))
  7.   offscreenBuffer = image(composewidth, composeheight, 32)
  8.   offscreenBuffer.fill(0, 0, composewidth, composeheight, rgb(0, 0, 0))
  9. end
  10.  
  11. on lightray Img, hdis, vdis
  12.   hdis = hdis - 127
  13.   vdis = vdis - 127
  14.   currentImage = Img.duplicate()
  15.   if (lightImage.ilk <> #image) or (offscreenBuffer.ilk <> #image) then
  16.     lightinit()
  17.   end if
  18.   lightImage.copyPixels(currentImage, lightImage.rect, lightImage.rect, [#blendLevel: 255])
  19.   offscreenBuffer.copyPixels(lightImage, offscreenBuffer.rect, offscreenBuffer.rect, [#blendLevel: 255])
  20.   repeat with i = 1 to 12
  21.     per = i / 30.0
  22.     per2 = 1 - ((i - 1) / 12.0)
  23.     offscreenBuffer.copyPixels(lightImage, rect(0 - (i * 10) + (hdis * per), 0 - (i * 10) + (vdis * per), Img.width + (i * 10) + (hdis * per), Img.height + (i * 10) + (vdis * per)), offscreenBuffer.rect, [#blendLevel: 255 * per2])
  24.   end repeat
  25.   currentImage.copyPixels(offscreenBuffer, currentImage.rect, offscreenBuffer.rect)
  26.   if oldcomposerect <> composerect then
  27.     lightinit()
  28.     oldcomposerect = composerect
  29.   end if
  30.   return currentImage
  31. end
  32.  
  33. on lightray2 Img, hdis, vdis
  34.   hdis = hdis - 127
  35.   vdis = vdis - 127
  36.   currentImage = Img.duplicate()
  37.   if (lightImage.ilk <> #image) or (offscreenBuffer.ilk <> #image) then
  38.     lightinit()
  39.   end if
  40.   lightImage.copyPixels(blurr(currentImage), lightImage.rect, lightImage.rect, [#blendLevel: 255])
  41.   offscreenBuffer.copyPixels(lightImage, offscreenBuffer.rect, offscreenBuffer.rect, [#blendLevel: 255])
  42.   repeat with i = 1 to 12
  43.     per = i / 30.0
  44.     per2 = 1 - ((i - 1) / 12.0)
  45.     offscreenBuffer.copyPixels(lightImage, rect(0 - (i * 10) + (hdis * per), 0 - (i * 10) + (vdis * per), Img.width + (i * 10) + (hdis * per), Img.height + (i * 10) + (vdis * per)), offscreenBuffer.rect, [#blendLevel: 255 * per2])
  46.   end repeat
  47.   currentImage.copyPixels(offscreenBuffer, currentImage.rect, offscreenBuffer.rect)
  48.   if oldcomposerect <> composerect then
  49.     lightinit()
  50.     oldcomposerect = composerect
  51.   end if
  52.   return currentImage
  53. end
  54.